package com.wqr.mobile.android.ui;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

/**
 * activity templete
 * 
 * @author wenqiurong
 * 
 */
public abstract class AbsActivity extends Activity {
	public static String TAG;
//	public String mSid;
//	public Dialog mDialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		TAG = this.getClass().getSimpleName();
//		mSid = SharedPrefsUtil.getValue(this, Conf.KEY_SID, "");
		setUp();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		destory();
		Log.i(TAG, "templete onDestroy");
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
			finish();
			return false;
		} else {
			return super.onKeyDown(keyCode, event);
		}
	}

	@Override
	public void onLowMemory() {
		System.gc();
		super.onLowMemory();
	}

	/**
	 * activity Initializa
	 */
	protected abstract void setUp();

	/**
	 * clear object
	 */
	protected abstract void destory();

}
